package com.lcxw.hxzb.friendcircle.project.system.mapper;

import com.lcxw.hxzb.friendcircle.project.system.domain.YwpdMember;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Component
@Mapper
@Service
public interface YwpdMemberMapper {

    //查询用户通过userId
    @Select("SELECT * FROM ywpd_member WHERE userid = #{userId}")
    YwpdMember selectYwpdMemberByUserId(long userId);

    //通过userId给用户添加虚拟货币数量，主要用于用户充值
    @Update("UPDATE ywpd_member SET earnBean = earnBean + #{coin}  where userId = #{userId}")
    int updateCoinByUserId(@Param("coin") int coin, @Param("userId") long userId);


    //更新用户
    @Update("UPDATE ywpd_member SET id = #{id},telephone = #{telephone},"
            + "username = #{userName},nickname = #{nickName},idcard = #{idCard},"
            + "intro = #{intro},realname = #{realName},sex = #{sex},"
            + "area = #{area}, province = #{province},"
            + "city = #{city},birthday = #{birthday},interest = #{interest},"
            + "password = #{password},regtime = #{regTime},lastlogtime = #{lastLogTime},"
            + "lastlogip = #{lastLogIp},roomid = #{roomId},maxonline = #{maxOnline},"
            + "sign = #{sign},bakpicurl = #{bakPicUrl},imgurl = #{imgUrl},"
            + "vip = #{vip},vipexpire = #{vipExpire},goldkey = #{goldKey},"
            + "awexpire = #{awExpire},spendcoin = #{spendCoin},earnbean = #{earnBean},"
            + "beanbalance = #{beanBalance},beanbalance2 = #{beanBalance2},beanbalance3 = #{beanBalance3},"
            + "freezestatus = #{freezeStatus},offlinevideo = #{offlineVideo},signature = #{signature},"
            + "qq = #{qq},address = #{address},daoju1 = #{daoju1},"
            + "daoju1expire = #{daoju1Expire},emceeagenttime = #{emceeAgentTime},"
            + "age = #{age},occupation = #{occupation},school = #{school},"
            + "realNameAuth = #{realNameAuth} , liveStatus=#{liveStatus},cancelled=#{cancelled},"
            + "longitude = #{longitude} , latitude=#{latitude},"
            + "openId = #{openId},iosId=#{iosId}"
            + "  where userid = #{userId}")
    int updateYwpdMember(YwpdMember ywpdMember);
}
